﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AkazoNobel.Scheduler.StoreMasterData.Common;
using AkazoNobel.Scheduler.StoreMasterData.DataAccess.Model;
using Dapper;

namespace AkazoNobel.Scheduler.StoreMasterData.DataAccess.Service
{
    public static class SmdDeviceService
    {
        public static List<SmdDevice> GetAllDevices()
        {
            using (var conn = SqlConnectionHelper.GetConnection(Constant.SMD_DB_NAME))
            {
                var devices = conn.Query<SmdDevice>("SELECT * FROM t_smd_Device").ToList();
                return devices;
            }
        }


        public static Dealer GetByDealerCode(string DealerCode)
        {
            using (var conn = SqlConnectionHelper.GetConnection(Constant.SMD_DB_NAME))
            {
                var dealer = conn.Query<Dealer>("SELECT * FROM t_smd_Dealer WHERE DealerCode=@DealerCode",
                    new { DealerCode }).FirstOrDefault();

                return dealer;
            }
        }


      
    }
}
